package com.roadjava.javaweb.student.beans.res;

import com.roadjava.javaweb.student.beans.entity.StudentDO;
import com.roadjava.javaweb.student.util.Constants;

import java.util.List;


public class TableResult<T> {
    private List<T> data;
    private int totalCount; // 总共多少条
    private int pageNow; // 透传
    private String studentName; // 透传


    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public int getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }

    public int getPageNow() {
        return pageNow;
    }

    public void setPageNow(int pageNow) {
        this.pageNow = pageNow;
    }

    public String getStudentName() {
        return studentName;
    }

    public void setStudentName(String studentName) {
        this.studentName = studentName;
    }

    /*
    总页数
     */
    public int getPageCount() {
        int pageCount = 0;
        if (totalCount % Constants.PAGE_SIZE == 0) {
            pageCount = totalCount / Constants.PAGE_SIZE;
        } else {
            pageCount = totalCount / Constants.PAGE_SIZE + 1;
        }
        return pageCount;
    }
}
